<template>
    <div class=" container">
        <header>
            <div>
                <i class="iconfont icon-fanhui" @click="$router.back()"></i>
            </div>
            <div>
                <span>支付</span>
            </div>
            <div>
                <i class="iconfont icon-home"></i>
            </div>
        </header>
        <section>
            <van-empty image="error" description="支付成功" v-if="payStatus"/>
            <van-empty image="error" description="支付失败" v-else/>
        </section>
    </div>
</template>

<script>
import http from '@/common/api/request';
import qs from 'qs';
    export default {
        data(){
            return{
                payStatus:false
            } 
        },
        name:"My",
        created(){
            this.getData();
        },
        methods: {
            getData(){

                //支付传递的参数
                let data = {
                    out_trade_no:this.$route.query.out_trade_no,
                    trade_no:this.$route.query.trade_no,
                }
                http.$axios({
                    url:'/api/successPayment',
                    method:"post",
                    headers:{
                        token:true,
                    },
                    //qs是增加安全性的序列化
                    data:qs.stringify(data)
                }).then(res=>{
                    if(res.code ==2){
                        this.payStatus = true
                    }
                })
            }
        }
    }
</script>

<style lang="scss" scoped>

</style>